<template>
  <el-dropdown trigger="click" :hide-on-click="false">
    <i class="iconfont icon-command" z-index="2" style="font-size: 20px;"></i>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item>
        <el-row>
          <el-col style="margin:15px 0;font-size: 1.2em;">导航样式：</el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-switch
              v-model="v_navbarLayoutType"
              active-color="#13ce66"
              inactive-color="#ff4949"
              active-text="白色"
              inactive-text="主色">
            </el-switch>
          </el-col>
        </el-row>
      </el-dropdown-item>
      <el-dropdown-item>
        <el-row>
          <el-col style="margin:15px 0;font-size: 1.2em;">侧栏样式：</el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-switch
              v-model="v_sidebarLayoutSkin"
              active-color="#13ce66"
              inactive-color="#ff4949"
              active-text="暗色"
              inactive-text="亮色">
            </el-switch>
          </el-col>
        </el-row>
      </el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
  import { mapGetters } from 'vuex'
  export default {
    computed: {
      ...mapGetters(['navbarLayoutType', 'sidebarLayoutSkin']),
      // 设置导航条样式
      v_navbarLayoutType: {
        get () {
          return this.navbarLayoutType.default
        },
        set () {
          this.$store.dispatch('toggleNavbar')
        }
      },
      // 设置侧边栏颜色
      v_sidebarLayoutSkin: {
        get () {
          return this.sidebarLayoutSkin.dark
        },
        set () {
          this.$store.dispatch('toggleSidebarSkin')
        }
      }
    }
  }
</script>


